4c46c30d25
it's hard to test anything without a user / http auth / login / session.
35 lines
806 B
Python
35 lines
806 B
Python
"""
|
|
Tests for api package.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
|
|
def test_myip(client):
|
|
response = client.get(reverse('myip'))
|
|
assert response.status_code == 200
|
|
assert response.content in ['127.0.0.1', '::1']
|
|
|
|
|
|
def test_nic_update(client):
|
|
response = client.get(reverse('nic_update'))
|
|
assert response.status_code == 401
|
|
|
|
|
|
def test_nic_update_session(client):
|
|
response = client.get(reverse('nic_update_authorized'))
|
|
assert response.status_code == 302 # redirects to login view
|
|
|
|
|
|
def test_detect_ip(client):
|
|
response = client.get(reverse('detectip', args=('invalid_session_id', )))
|
|
assert response.status_code == 204
|
|
|
|
|
|
def test_ajax_get_ips(client):
|
|
response = client.get(reverse('ajax_get_ips'))
|
|
assert response.status_code == 200
|
|
|