typeworld / typeworld

Compare 685f167 ... +7 ... 3da31e5

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 2 of 4 files from the diff.

@@ -154,7 +154,6 @@
Loading
154 154
            typeworld.api.INSTALLABLEFONTSCOMMAND["acceptableMimeTypes"],
155 155
            data=data,
156 156
        )
157 -
        api = root.installableFonts
158 157
159 158
        if responses["errors"]:
160 159
@@ -168,18 +167,18 @@
Loading
168 167
            self.subscription._updatingProblem = "\n".join(responses["errors"])
169 168
            return False, self.subscription._updatingProblem, False
170 169
171 -
        if api.response == "error":
170 +
        if root.installableFonts.response == "error":
172 171
            if (
173 172
                self.url.unsecretURL()
174 173
                in self.subscription.parent._updatingSubscriptions
175 174
            ):
176 175
                self.subscription.parent._updatingSubscriptions.remove(
177 176
                    self.url.unsecretURL()
178 177
                )
179 -
            self.subscription._updatingProblem = api.errorMessage
178 +
            self.subscription._updatingProblem = root.installableFonts.errorMessage
180 179
            return False, self.subscription._updatingProblem, False
181 180
182 -
        if api.response in (
181 +
        if root.installableFonts.response in (
183 182
            "temporarilyUnavailable",
184 183
            "insufficientPermission",
185 184
            "loginRequired",
@@ -192,15 +191,22 @@
Loading
192 191
                    self.url.unsecretURL()
193 192
                )
194 193
            self.subscription._updatingProblem = [
195 -
                f"#(response.{api.response})",
196 -
                f"#(response.{api.response}.headline)",
194 +
                f"#(response.{root.installableFonts.response})",
195 +
                f"#(response.{root.installableFonts.response}.headline)",
197 196
            ]
198 197
            return (
199 198
                False,
200 -
                [f"#(response.{api.response})", f"#(response.{api.response}.headline)"],
199 +
                [
200 +
                    f"#(response.{root.installableFonts.response})",
201 +
                    f"#(response.{root.installableFonts.response}.headline)",
202 +
                ],
201 203
                False,
202 204
            )
203 205
206 +
        # Security check: Does url begin with canonicalURL?
207 +
        if not self.url.HTTPURL().startswith(root.endpoint.canonicalURL):
208 +
            return False, "'url' must begin with 'canonicalURL'", None
209 +
204 210
        # # Detect installed fonts now not available in subscription anymore and delete
205 211
        # them
206 212
        # hasFonts = False
@@ -226,7 +232,7 @@
Loading
226 232
227 233
        # Newly available fonts
228 234
        newIDs = []
229 -
        for foundry in api.foundries:
235 +
        for foundry in root.installableFonts.foundries:
230 236
            for family in foundry.families:
231 237
                for font in family.fonts:
232 238
                    newIDs.append(font.uniqueID)
@@ -257,8 +263,10 @@
Loading
257 263
                )
258 264
259 265
        # Compare
260 -
        identical = self._installableFontsCommand.sameContent(api)
261 -
        self._installableFontsCommand = api
266 +
        identical = self._installableFontsCommand.sameContent(root.installableFonts)
267 +
268 +
        # Success
269 +
        self._installableFontsCommand = root.installableFonts
262 270
263 271
        # EndpointResponse
264 272
        if root.endpoint:
@@ -433,47 +441,49 @@
Loading
433 441
            data=data,
434 442
        )
435 443
436 -
        # InstallableFontsResponse
437 -
        api = root.installableFonts
438 -
439 -
        # EndpointResponse
440 -
        self._endpointCommand = root.endpoint
441 -
442 444
        # Errors
443 445
        if responses["errors"]:
444 446
            return False, responses["errors"][0]
445 447
446 448
        if (
447 -
            "installableFonts" not in self._endpointCommand.supportedCommands
448 -
            or "installFonts" not in self._endpointCommand.supportedCommands
449 +
            "installableFonts" not in root.endpoint.supportedCommands
450 +
            or "installFonts" not in root.endpoint.supportedCommands
449 451
        ):
450 452
            return (
451 453
                False,
452 454
                (
453 455
                    "API endpoint %s does not support the 'installableFonts' or "
454 456
                    "'installFonts' commands."
455 457
                )
456 -
                % self._endpointCommand.canonicalURL,
458 +
                % root.endpoint.canonicalURL,
457 459
            )
458 460
459 -
        if api.response == "error":
460 -
            if api.errorMessage:
461 -
                return False, api.errorMessage
461 +
        if root.installableFonts.response == "error":
462 +
            if root.installableFonts.errorMessage:
463 +
                return False, root.installableFonts.errorMessage
462 464
            else:
463 465
                return False, "api.response is error, but no error message was given"
464 466
465 467
        # Predefined response messages
466 -
        if api.response != "error" and api.response != "success":
468 +
        if (
469 +
            root.installableFonts.response != "error"
470 +
            and root.installableFonts.response != "success"
471 +
        ):
467 472
            return (
468 473
                False,
469 474
                [
470 -
                    "#(response.%s)" % api.response,
471 -
                    "#(response.%s.headline)" % api.response,
475 +
                    "#(response.%s)" % root.installableFonts.response,
476 +
                    "#(response.%s.headline)" % root.installableFonts.response,
472 477
                ],
473 478
            )
474 479
480 +
        # Security check: Does url begin with canonicalURL?
481 +
        if not self.url.HTTPURL().startswith(root.endpoint.canonicalURL):
482 +
            return False, "'url' must begin with 'canonicalURL'"
483 +
475 484
        # Success
476 -
        self._installableFontsCommand = api
485 +
        self._endpointCommand = root.endpoint
486 +
        self._installableFontsCommand = root.installableFonts
477 487
478 488
        # InstallFontsResponse
479 489
        if root.installFonts:

@@ -3149,6 +3149,17 @@
Loading
3149 3149
            user1.client.publishers()[0].subscriptions()[0].update()
3150 3150
        )
3151 3151
        self.assertEqual(success, False)
3152 +
3153 +
        user1.client.testScenario = "simulateImpersonatedCanonicalURL"
3154 +
        success, message, changes = user1.client.publishers()[0].update()
3155 +
        self.assertEqual(success, False)
3156 +
        self.assertEqual(message, "'url' must begin with 'canonicalURL'")
3157 +
        success, message, changes = (
3158 +
            user1.client.publishers()[0].subscriptions()[0].update()
3159 +
        )
3160 +
        self.assertEqual(success, False)
3161 +
        self.assertEqual(message, "'url' must begin with 'canonicalURL'")
3162 +
3152 3163
        user1.client.testScenario = "simulateProgrammingError"
3153 3164
        success, message, changes = user1.client.publishers()[0].update()
3154 3165
        self.assertEqual(success, False)
@@ -3545,26 +3556,37 @@
Loading
3545 3556
                "Expected is '['application/json']'."
3546 3557
            ),
3547 3558
        )
3559 +
        user2.client.testScenario = "simulateImpersonatedCanonicalURL"
3560 +
        success, message, publisher, subscription = user2.client.addSubscription(
3561 +
            protectedSubscription
3562 +
        )
3563 +
        self.assertEqual(success, False)
3564 +
        self.assertEqual(message, "'url' must begin with 'canonicalURL'")
3565 +
3548 3566
        user2.client.testScenario = "simulateNotHTTP200"
3549 3567
        success, message, publisher, subscription = user2.client.addSubscription(
3550 3568
            protectedSubscription
3551 3569
        )
3552 3570
        self.assertEqual(success, False)
3571 +
3553 3572
        user2.client.testScenario = "simulateProgrammingError"
3554 3573
        success, message, publisher, subscription = user2.client.addSubscription(
3555 3574
            protectedSubscription
3556 3575
        )
3557 3576
        self.assertEqual(success, False)
3577 +
3558 3578
        user2.client.testScenario = "simulateInvalidAPIJSONResponse"
3559 3579
        success, message, publisher, subscription = user2.client.addSubscription(
3560 3580
            protectedSubscription
3561 3581
        )
3562 3582
        self.assertEqual(success, False)
3583 +
3563 3584
        user2.client.testScenario = "simulateFaultyAPIJSONResponse"
3564 3585
        success, message, publisher, subscription = user2.client.addSubscription(
3565 3586
            protectedSubscription
3566 3587
        )
3567 3588
        self.assertEqual(success, False)
3589 +
3568 3590
        user2.client.testScenario = "simulateCentralServerNotReachable"
3569 3591
        success, message, publisher, subscription = user2.client.addSubscription(
3570 3592
            protectedSubscription

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
Lib/typeworld 0.01% 97.75%
Project Totals (6 files) 97.75%
Loading