mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Test oauth
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -109,8 +109,9 @@ iD.OAuth = function() {
|
||||
});
|
||||
};
|
||||
|
||||
oauth.setAPI = function(x) {
|
||||
apibase = x;
|
||||
oauth.api = function(_) {
|
||||
if (!arguments.length) return apibase;
|
||||
apibase = _;
|
||||
return oauth;
|
||||
};
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
<script type="text/javascript" src="spec/way.js"></script>
|
||||
<script type="text/javascript" src="spec/map.js"></script>
|
||||
<script type="text/javascript" src="spec/hash.js"></script>
|
||||
<script type="text/javascript" src="spec/oauth.js"></script>
|
||||
<script type="text/javascript" src="spec/graph.js"></script>
|
||||
<script type="text/javascript" src="spec/entity.js"></script>
|
||||
<script type="text/javascript" src="spec/connection.js"></script>
|
||||
|
||||
19
test/spec/oauth.js
Normal file
19
test/spec/oauth.js
Normal file
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user