diff --git a/js/id/connection.js b/js/id/connection.js
index eaa25ea93..baf767c6a 100644
--- a/js/id/connection.js
+++ b/js/id/connection.js
@@ -5,7 +5,7 @@ iD.Connection = function() {
connection = {},
refNodes = {},
user = {},
- oauth = iD.OAuth().setAPI(apiURL);
+ oauth = iD.OAuth().api(apiURL);
// Request data within the bbox from an external OSM server.
function bboxFromAPI(box, callback) {
@@ -134,7 +134,7 @@ iD.Connection = function() {
connection.url = function(x) {
if (!arguments.length) return apiURL;
apiURL = x;
- oauth.setAPI(x);
+ oauth.api(x);
return connection;
};
diff --git a/js/id/oauth.js b/js/id/oauth.js
index 70eef0a0a..b613b30cd 100644
--- a/js/id/oauth.js
+++ b/js/id/oauth.js
@@ -109,8 +109,9 @@ iD.OAuth = function() {
});
};
- oauth.setAPI = function(x) {
- apibase = x;
+ oauth.api = function(_) {
+ if (!arguments.length) return apibase;
+ apibase = _;
return oauth;
};
diff --git a/test/index.html b/test/index.html
index 33e0ebd73..ee2e98c3e 100644
--- a/test/index.html
+++ b/test/index.html
@@ -53,6 +53,7 @@
+
diff --git a/test/spec/oauth.js b/test/spec/oauth.js
new file mode 100644
index 000000000..192a5b93a
--- /dev/null
+++ b/test/spec/oauth.js
@@ -0,0 +1,19 @@
+describe('OAuth', function() {
+ var o;
+ beforeEach(function() {
+ o = iD.OAuth();
+ });
+ describe('#logout', function() {
+ it('can log out and will no longer be authenticated', function() {
+ expect(o.logout()).toEqual(o);
+ expect(o.authenticated()).toBeFalsy();
+ });
+ });
+ describe('#api', function() {
+ it('gets and sets url', function() {
+ expect(o.api('foo')).toEqual(o);
+ expect(o.api()).toBe('foo');
+ });
+ });
+
+});