Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
onekiloparsec committed Jan 4, 2020
2 parents 427a41f + ee4cd21 commit 9f1b8bc
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 29 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Python package

on:
push:
branches:
- master
on: [push]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion arcsecond/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"ArcsecondConnectionError",
"ArcsecondInvalidEndpointError"]

__version__ = '0.7.0'
__version__ = '0.7.1'
9 changes: 8 additions & 1 deletion arcsecond/api/endpoints/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
import requests
from progress.spinner import Spinner

from arcsecond.api.constants import *
from arcsecond.api.constants import (
ARCSECOND_API_URL_DEV,
ARCSECOND_API_URL_PROD,
ARCSECOND_WWW_URL_DEV,
ARCSECOND_WWW_URL_PROD,
API_AUTH_PATH_LOGIN,
API_AUTH_PATH_REGISTER)

from arcsecond.api.error import ArcsecondConnectionError, ArcsecondError
from arcsecond.config import config_file_read_api_key, config_file_read_organisation_memberships
from arcsecond.options import State
Expand Down
8 changes: 7 additions & 1 deletion arcsecond/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
config_file_read_api_key,
config_file_save_api_key,
config_file_save_organisation_membership)

from arcsecond.options import State
from .auth import AuthAPIEndPoint
from .error import ArcsecondInvalidEndpointError, ArcsecondNotLoggedInError, ArcsecondTooManyPrefixesError
from .helpers import make_file_upload_payload
from .endpoints import *

from .endpoints import (ActivitiesAPIEndPoint, CataloguesAPIEndPoint, DatasetsAPIEndPoint, ExoplanetsAPIEndPoint,
DataFilesAPIEndPoint, FindingChartsAPIEndPoint, InstrumentsAPIEndPoint, NightLogAPIEndPoint,
ObjectsAPIEndPoint, ObservingRunsAPIEndPoint, ObservingSitesAPIEndPoint,
PersonalProfileAPIEndPoint, ProfileAPIEndPoint, ProfileAPIKeyAPIEndPoint, SatellitesAPIEndPoint,
StandardStarsAPIEndPoint, TelegramsATelAPIEndPoint, TelescopesAPIEndPoint)

pp = pprint.PrettyPrinter(indent=4, depth=5)
ECHO_PREFIX = u' • '
Expand Down
24 changes: 5 additions & 19 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,16 @@ def test_register_refuse_agreement(monkeypatch):
assert result.exit_code != 0 and result.exception


@httpretty.activate
def test_register_agree_on_agreement(monkeypatch):
runner = CliRunner()
monkeypatch.setattr('six.moves.input', lambda x: "y")
httpretty.register_uri(
httpretty.POST,
ARCSECOND_API_URL_DEV + API_AUTH_PATH_REGISTER,
status=201,
body='{"key": "dummy_api_key."}'
)
result = runner.invoke(cli.register, ['-d'], input='test16\n[email protected]\ntest1\ntest1')
assert result.exit_code == 0 and not result.exception

# I can't find a way to use httpretyy.activate and monkeypatch at the same time.
# @httpretty.activate
# def test_register_agree_agreement(monkeypatch):
# def test_register_agree_on_agreement(monkeypatch):
# runner = CliRunner()
# httpretty.register_uri(
# httpretty.POST,
# ARCSECOND_API_URL_DEV + API_AUTH_PATH_REGISTER,
# status=201,
# body='{"token": "dummy_token."}'
# body='{"key": "dummy_api_key."}'
# )
# for answer in ['y', 'Y', 'yes', 'YES']:
# monkeypatch.setattr('six.moves.input', lambda x: answer)
# result = runner.invoke(cli.register, ['-d'], input='test\[email protected]\ntest1\ntest1')
# assert result.exit_code == 0 and not result.exception
# monkeypatch.setattr('six.moves.input', lambda x: "y")
# result = runner.invoke(cli.register, ['-d'], input='test16\[email protected]\ntest1\ntest1')
# assert result.exit_code == 0 and not result.exception
4 changes: 2 additions & 2 deletions tests/test_datasets_organisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@


class DatasetsInOrganisationsTestCase(TestCase):
def setUp(self) -> None:
def setUp(self):
config_file_clear_debug_session()
httpretty.enable()

def tearDown(self) -> None:
def tearDown(self):
httpretty.disable()

def test_datasets_list_unlogged(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_datasets_personal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from arcsecond import cli
from arcsecond.api.constants import ARCSECOND_API_URL_DEV
from .utils import register_successful_personal_login, register_successful_organisation_login
from .utils import register_successful_personal_login


@httpretty.activate
Expand Down

0 comments on commit 9f1b8bc

Please sign in to comment.