7 "github.com/stretchr/testify/assert"
10const formatJSON = "format=json"
12func testNextcloudProvider(hostname string) *NextcloudProvider {
13 p := NewNextcloudProvider(
17 RedeemURL: &url.URL{},
18 ProfileURL: &url.URL{},
19 ValidateURL: &url.URL{},
22 updateURL(p.Data().LoginURL, hostname)
23 updateURL(p.Data().RedeemURL, hostname)
24 updateURL(p.Data().ProfileURL, hostname)
25 updateURL(p.Data().ValidateURL, hostname)
30func TestNextcloudProviderDefaults(t *testing.T) {
31 p := testNextcloudProvider("")
32 assert.NotEqual(t, nil, p)
33 assert.Equal(t, "Nextcloud", p.Data().ProviderName)
35 p.Data().LoginURL.String())
37 p.Data().RedeemURL.String())
39 p.Data().ValidateURL.String())
42func TestNextcloudProviderOverrides(t *testing.T) {
43 p := NewNextcloudProvider(
48 Path: "/index.php/apps/oauth2/authorize"},
52 Path: "/index.php/apps/oauth2/api/v1/token"},
53 ValidateURL: &url.URL{
56 Path: "/test/ocs/v2.php/cloud/user",
57 RawQuery: formatJSON},
59 assert.NotEqual(t, nil, p)
60 assert.Equal(t, "Nextcloud", p.Data().ProviderName)
61 assert.Equal(t, "https://example.com/index.php/apps/oauth2/authorize",
62 p.Data().LoginURL.String())
63 assert.Equal(t, "https://example.com/index.php/apps/oauth2/api/v1/token",
64 p.Data().RedeemURL.String())
65 assert.Equal(t, "https://example.com/test/ocs/v2.php/cloud/user?"+formatJSON,
66 p.Data().ValidateURL.String())
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list