Example #1
0
    def setUp(self):
        # The test case class somehow messes with the plugins - thus we have
        # to initialize them all the time.
        initialize_plugins()

        self.user = User.objects.get_or_create(
            username='******', password=make_password('random'))[0]
        self.user.user_permissions.add(Permission.objects.filter(
            codename='can_modify_stationxml').first())

        credentials = base64.b64encode(b'random:random')
        self.valid_auth_headers = {
            'HTTP_AUTHORIZATION': 'Basic ' + credentials.decode("ISO-8859-1")
        }

        credentials = base64.b64encode(b'random:random2')
        self.invalid_auth_headers = {
            'HTTP_AUTHORIZATION': 'Basic ' + credentials.decode("ISO-8859-1")
        }

        # Mocking makes the plotting fails which is the slow operation -
        # thus the tests execute much faster.
        with mock.patch("obspy.core.inventory.channel.Channel.plot"):
            # Add a station.
            with open(FILES["BW.ALTM.xml"], "rb") as fh:
                Document.objects.add_or_modify_document(
                    document_type="stationxml",
                    name="station.xml",
                    data=fh.read(),
                    user=self.user)
Example #2
0
    def setUp(self):
        # The test case class somehow messes with the plugins - thus we have
        # to initialize them all the time.
        initialize_plugins()

        self.user = User.objects.get_or_create(
            username='******', password=make_password('random'))[0]
        self.user.user_permissions.add(
            Permission.objects.filter(
                codename='can_modify_stationxml').first())

        credentials = base64.b64encode(b'random:random')
        self.valid_auth_headers = {
            'HTTP_AUTHORIZATION': 'Basic ' + credentials.decode("ISO-8859-1")
        }

        credentials = base64.b64encode(b'random:random2')
        self.invalid_auth_headers = {
            'HTTP_AUTHORIZATION': 'Basic ' + credentials.decode("ISO-8859-1")
        }

        # Mocking makes the plotting fails which is the slow operation -
        # thus the tests execute much faster.
        with mock.patch("obspy.core.inventory.channel.Channel.plot"):
            # Add a station.
            with open(FILES["BW.ALTM.xml"], "rb") as fh:
                Document.objects.add_or_modify_document(
                    document_type="stationxml",
                    name="station.xml",
                    data=fh.read(),
                    user=self.user)
Example #3
0
    def setUp(self):
        # The test case class somehow messes with the plugins - thus we have
        # to initialize them all the time.
        initialize_plugins()

        self.user = User.objects.get_or_create(
            username='******', password=make_password('random'))[0]

        self.can_modify_stationxml_permission = \
            Permission.objects.filter(codename='can_modify_stationxml').first()

        credentials = base64.b64encode(b'random:random')
        self.valid_auth_headers = {
            'HTTP_AUTHORIZATION': 'Basic ' + credentials.decode("ISO-8859-1")
        }
Example #4
0
    def setUp(self):
        # The test case class somehow messes with the plugins - thus we have
        # to initialize them all the time.
        initialize_plugins()

        self.user = User.objects.get_or_create(
            username='******', password=make_password('random'))[0]

        self.can_modify_stationxml_permission = \
            Permission.objects.filter(codename='can_modify_stationxml').first()

        credentials = base64.b64encode(b'random:random')
        self.valid_auth_headers = {
            'HTTP_AUTHORIZATION': 'Basic ' + credentials.decode("ISO-8859-1")
        }
Example #5
0
 def setUp(self):
     # The test case class somehow messes with the plugins - thus we have
     # to initialize them all the time.
     initialize_plugins()
Example #6
0
 def setUp(self):
     # The test case class somehow messes with the plugins - thus we have
     # to initialize them all the time.
     initialize_plugins()