Compare commits

...

8 commits

Author SHA1 Message Date
dependabot[bot] 66d86fb092 Bump github.com/stretchr/testify from 1.8.0 to 1.8.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-31 16:38:21 +01:00
Sighery bfc94ffc04 Switch actions/checkout to major v3 version
It's a bit of a pain to constantly update patch versions, as this is
just CI and unrelated to the main focus which is the codebase. So in
these cases, I don't want to run CI again just because the `checkout`
action had an update.
2022-10-31 16:36:56 +01:00
Sighery 997979f1b8 Adapt to API using string ID
Previously the API would use integer IDs. This has been silently
changed at some point, and now all IDs are strings, even though they
seem to still be numeric.

From this Github issue https://github.com/go-acme/lego/issues/1685
Njalla devs have confirmed this was an intentional change and all IDs
will be strings going forward, meaning we shouln't just have an
adapter to keep using our integer IDs, since they might also move away
from numeric IDs in the future, and switch to UUID or some other
alphanumeric ID.
2022-08-14 20:46:25 +02:00
Sighery ef93a5772e Update project to Go v1.17 2022-08-14 20:37:16 +02:00
Sighery 2aded968d2 Remove CodeQL Analysis CI workflow
I don't use it and so far haven't found it useful either. I might add
it back at some point after I get more time to tinker with it.
2022-08-14 17:38:26 +02:00
dependabot[bot] cc5aa6c9ed Bump github.com/stretchr/testify from 1.7.0 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-14 17:34:52 +02:00
dependabot[bot] 6afd3822b2 Bump actions/checkout from 2.4.0 to 3.0.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3.0.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-14 17:32:25 +02:00
dependabot[bot] b7148fab83 Bump actions/checkout from 2.3.4 to 2.4.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.4.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.4.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-08 21:59:34 +01:00
6 changed files with 36 additions and 96 deletions

View file

@ -1,71 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 8 * * 6'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['go']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View file

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v3
- name: Install dependencies
run: go get

10
go.mod
View file

@ -1,5 +1,11 @@
module github.com/Sighery/gonjalla
go 1.14
go 1.17
require github.com/stretchr/testify v1.7.0
require github.com/stretchr/testify v1.8.1
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

15
go.sum
View file

@ -1,12 +1,17 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View file

@ -10,7 +10,7 @@ var ValidPriority = []int{0, 1, 5, 10, 20, 30, 40, 50, 60}
// Record struct contains data returned by `list-records`
type Record struct {
ID int `json:"id"`
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Content string `json:"content"`
@ -75,7 +75,7 @@ func AddRecord(token string, domain string, record Record) (Record, error) {
// RemoveRecord removes a given record from a given domain.
// If there are no errors it will return `nil`.
func RemoveRecord(token string, domain string, id int) error {
func RemoveRecord(token string, domain string, id string) error {
params := map[string]interface{}{
"domain": domain,
"id": id,

View file

@ -21,28 +21,28 @@ func TestListRecordsExpected(t *testing.T) {
"result": {
"records": [
{
"id": 1337,
"id": "1337",
"name": "_acme-challenge",
"type": "TXT",
"content": "long-string",
"ttl": 10800
},
{
"id": 1338,
"id": "1338",
"name": "@",
"type": "A",
"content": "1.2.3.4",
"ttl": 3600
},
{
"id": 1339,
"id": "1339",
"name": "@",
"type": "AAAA",
"content": "2001:0DB8:0000:0000:0000:8A2E:0370:7334",
"ttl": 900
},
{
"id": 1340,
"id": "1340",
"name": "@",
"type": "MX",
"content": "mail.protonmail.ch",
@ -70,28 +70,28 @@ func TestListRecordsExpected(t *testing.T) {
expected := []Record{
{
ID: 1337,
ID: "1337",
Name: "_acme-challenge",
Type: "TXT",
Content: "long-string",
TTL: 10800,
},
{
ID: 1338,
ID: "1338",
Name: "@",
Type: "A",
Content: "1.2.3.4",
TTL: 3600,
},
{
ID: 1339,
ID: "1339",
Name: "@",
Type: "AAAA",
Content: "2001:0DB8:0000:0000:0000:8A2E:0370:7334",
TTL: 900,
},
{
ID: 1340,
ID: "1340",
Name: "@",
Type: "MX",
Content: "mail.protonmail.ch",
@ -140,7 +140,7 @@ func TestAddRecordExpected(t *testing.T) {
testData := `{
"jsonrpc": "2.0",
"result": {
"id": 1337,
"id": "1337",
"name": "@",
"type": "MX",
"content": "testing.com",
@ -173,7 +173,7 @@ func TestAddRecordExpected(t *testing.T) {
}
expected := Record{
ID: 1337,
ID: "1337",
Name: "@",
Type: "MX",
Content: "testing.com",
@ -221,7 +221,7 @@ func TestAddRecordError(t *testing.T) {
func TestRemoveRecordExpected(t *testing.T) {
token := "test-token"
domain := "testing.com"
id := 1337
id := "1337"
Client = &mocks.MockClient{}
testData := `{
@ -244,7 +244,7 @@ func TestRemoveRecordExpected(t *testing.T) {
func TestRemoveRecordError(t *testing.T) {
token := "test-token"
domain := "testing.com"
id := 1337
id := "1337"
Client = &mocks.MockClient{}
testData := `{
@ -275,7 +275,7 @@ func TestEditRecordExpected(t *testing.T) {
testData := `{
"jsonrpc": "2.0",
"result": {
"id": 1337,
"id": "1337",
"name": "@",
"type": "MX",
"content": "testing.com",
@ -294,7 +294,7 @@ func TestEditRecordExpected(t *testing.T) {
priority := 10
editing := Record{
ID: 1337,
ID: "1337",
Name: "@",
Type: "MX",
Content: "testing.com",
@ -329,7 +329,7 @@ func TestEditRecordError(t *testing.T) {
priority := 10
editing := Record{
ID: 1337,
ID: "1337",
Name: "@",
Type: "MX",
Content: "testing.com",